<?php
class Cust_info_model extends CI_Model{

	function getAllCustInfo(){
		$data=$this->db->query('select * from cust_info');
		return $data;
	}

	function delCustInfo($custid){
		$this->db->where('custid',$custid);
		$data=$this->db->delete('cust_info');
		return $data;
	}

	function getCustInfo($custid){
		$this->db->where('id',$custid);
		$data=$this->db->get('cust_info');
		return $data;
	}

	function addCustInfo(){
		$data=array(
				'phone'=>$_POST['phone'],
				'password'=>$_POST['password'],
				'custna'=>$_POST['name'],
				'email'=>$_POST['email']
		);
		$this->db->insert('cust_info',$data);
		return $this->db->insert_id();
	}

	function  updateCustInfo($custid,$data){
		$this->db->where('$custid',$custid);
		$this->db->update('cust_info',$data);
	}

	function getServer(){
		$data=$this->db->query('select * from server_info');
		return $data;
	}
	function getInfo($email){
		$data=$this->db->query("select * from cust_info where email = '".$email."'");
		return $data;
	}

	function getEmploye($serverid){

		$data=$this->db->query('select b.employeid,b.employena from emp_ser_count a, employe_info b where a.employeid=b.employeid and a.serverid = '.$serverid);
		return $data;
	}

	function checkLogin(){
		$this->db->where('email',$_POST['email']);
		$this->db->where('password',$_POST['password']);
		$data=$this->db->get('cust_info');
		if ($data->num_rows() > 0)
		return true;
		else
		return false;
	}
}
?>